let app = getApp()
// if (jinghe_id == 176) {
//     var tabbarList =  require('../../../config/router2.js')
// } else {
//     var tabbarList =  require('../../../config/router.js')
// }
let yuming = app.globalData.yuming
// components/tabbar/index.js
Component({
    /**
     * 组件的属性列表
     */
    properties: {
        activeIdx: {
            type: Number,
            value: 0
        },
        jgweidu: {
            type: Number,
            value: 0
        },
        grweidu: {
            type: Number,
            value: 0
        },
        auth: {
            type: Number,
            value: 0,
            observer: 'onAuthChanged'
        }
    },

    /**
     * 组件的初始数据
     */
    data: {
        tabbarList: '',
        _auth: 0,
        activeIdx: 0,
        idx: 0,
        jgweidu: 0,
        grweidu: 0,
        jinghe_id:''
    },
    ready: function () {
        this.setData({
            jgweidu: this.properties.jgweidu,
            grweidu: this.properties.grweidu,
            jinghe_id:wx.getStorageSync('jinghe_id')
        })
        if (this.data.jinghe_id == 176) {
            var tabbarList = require('../../../config/router2.js')
        } else {
            var tabbarList = require('../../../config/router.js')
        }
        this.setData({
            tabbarList:tabbarList
        })
        console.log(tabbarList)
        // var that = this
        // wx.request({
        //   url: yuming + 'besall/messageHongdian',
        //   method: 'POST',
        //   header: {
        //     'Content-Type': 'application/x-www-form-urlencoded',
        //     token: wx.getStorageSync('token'),
        //     source:'EabEnd'
        //   },
        //   data: {
        //     shopId: wx.getStorageSync('shopId')
        //   },
        //   success: function (res) {
        //     // console.log(2222222222222)
        //     console.log(res.data.data)
        //     that.properties.jgweidu = res.data.data.jg_count
        //     that.properties.grweidu = res.data.data.gr_count

        //   },
        //   fail: function () {
        //     app.consoleLog("请求数据失败");
        //   }
        // })
    },
    /**
     * 组件的方法列表
     */
    methods: {
        handleItemTap(e) {
            const {
                idx,
                path
            } = e.currentTarget.dataset

            if (idx === this.data.activeIdx) {
                this.trigger('refresh')
                return
            }

            wx.switchTab({
                url: `/${path}`,
            })
        },
    }
})